package com.twt.common.utils;

import cn.hutool.core.collection.CollectionUtil;
import com.twt.common.exceptions.AppException;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

public class Assert {
    private Assert(){}
    public static void isBlank(String text,String message){
        if (StringUtils.isBlank(text)){
            throw new AppException(message);
        }
    }

    public static void isNotEmpty(List list, String message) {
        if (CollectionUtil.isNotEmpty(list)){
            throw new AppException(message);
        }
    }

    public static void isTrue(boolean b, String message) {
        if (b){
            throw new AppException(message);
        }
    }
}
